% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/calibrate_1way.R
\name{calib_oneway}
\alias{calib_oneway}
\title{Find one-way (intercept) correction for cell estimates}
\source{
FindDelta function at
https://github.com/Catalist-LLC/unemployment/blob/master/unemployment_cps_mrp/helper_functions/GetYHat.R

Also see Evan T. R. Rosenman and Santiago Olivella,
"Recalibration of Predictive Models as Approximate Probabilistic Updates"
\url{https://arxiv.org/abs/2112.06674}
}
\usage{
calib_oneway(tgt, ests, n, search = c(-5, 5))
}
\arguments{
\item{tgt}{The true target}

\item{ests}{A vector of current estimate, by cell}

\item{n}{The sample size of the estimates, by cell}

\item{search}{The lower and upper endpoints of the interval to search}
}
\value{
The value of delta or the intercept that minimizes
the absolute deviation in total. The value is on the logit scale.
To translate to a probability, use invlogit.
}
\description{
For a given geography \code{j}, there may be a value \code{pi_j} which is
the ground truth. The analyst has \code{C} cells with estimates of \code{pi_c} that
may be biased. This function, proposed by Ghitza and Gelman
and Ghitza, will find a intercept shift for all \verb{C cells to best fit the total }pi`. It is the argmin of the sum of
absolute values of the deviation.
}
\examples{

 biased_ests <- ccesMRPrun:::invlogit(rnorm(n = 100, mean = 1, sd = 1))
 sizes <- rbinom(n = 100, size = 100, prob = 0.1)
 tru <- 0.5

 calib_oneway(tgt = tru, ests = biased_ests, n = sizes)

}
\seealso{
calib_twoway
}
\author{
Yair Ghitza
}
